package com.biz.imp;

import java.util.*;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bean.Market;
import com.biz.MarketBiz;
import com.service.MapperService;
@Service
@Transactional
public class MarketBizImp implements MarketBiz {
	@Autowired
	private MapperService mapperService;
	
	public MapperService getMapperService() {
		return mapperService;
	}

	public void setMapperService(MapperService mapperService) {
		this.mapperService = mapperService;
	}

	public int save(Market market) {
		int code=mapperService.getMarketMapper().insert(market);
		return code;
	}

	public int update(Market market) {
		int code=mapperService.getMarketMapper().updateByPrimaryKey(market);
		return code;
	}

	public int delById(Integer mid) {
		int code=mapperService.getMarketMapper().deleteByPrimaryKey(mid);
		return code;
	}

	public Market findById(Integer mid) {
		Market market=mapperService.getMarketMapper().selectByPrimaryKey(mid);
		return market;
	}

	public List<Market> findPageAll(int page, int rows) {
		if(page<1)page=1;
		if(rows<1)rows=5;
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("page", page);
		map.put("rows", rows);
		List<Market> lsmk=mapperService.getMarketMapper().findPageAll(map);
		return lsmk;
	}

	public int findMaxRow() {
		
		return mapperService.getMarketMapper().findMaxRow();
	}

}
